#!/bin/sh
echo "=======install zookeeper========="
v_soft_path="/usr/local/atwork/"

v_install_store_path="/tmp/atwork/"

v_install_file="zookeeper-3.4.6.tar.gz"

v_install_dir="zookeeper-3.4.6"

#检测软件安装目录是否存在
f_soft_path_check(){
  if [ ! -d "$v_soft_path" ];then
    mdkir -p "$v_soft_path"
  fi
}

#检测安装文件是存在
f_install_file_exists(){
  if [ ! -f "${v_install_store_path}${v_install_file}"  ]; then
    echo "zookeeper install file not exists:${v_install_store_path}${v_install_file}"
    exit 1
  fi 
}

#解压安装文件到指定目录
f_install_file(){
  tar -zxvf ${v_install_store_path}${v_install_file} -C $v_soft_path
}


f_soft_path_check

f_install_file_exists

f_install_file
echo "========install zookeeper OK======"
